package com.example.administrator.familfinalcialmanagement.greendao.gen;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.example.administrator.familfinalcialmanagement.bean.CommonUser;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "COMMON_USER".
*/
public class CommonUserDao extends AbstractDao<CommonUser, Long> {

    public static final String TABLENAME = "COMMON_USER";

    /**
     * Properties of entity CommonUser.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
        public final static Property Name = new Property(1, String.class, "name", false, "NAME");
        public final static Property Sex = new Property(2, String.class, "sex", false, "SEX");
        public final static Property Phone = new Property(3, String.class, "phone", false, "PHONE");
        public final static Property Pwd = new Property(4, String.class, "pwd", false, "PWD");
        public final static Property PwdStatus = new Property(5, String.class, "pwdStatus", false, "PWD_STATUS");
        public final static Property ClassNameOne = new Property(6, String.class, "classNameOne", false, "CLASS_NAME_ONE");
        public final static Property ClassOneNum = new Property(7, String.class, "classOneNum", false, "CLASS_ONE_NUM");
        public final static Property ClassNameTwo = new Property(8, String.class, "classNameTwo", false, "CLASS_NAME_TWO");
        public final static Property ClassTwoNum = new Property(9, String.class, "classTwoNum", false, "CLASS_TWO_NUM");
        public final static Property ClassNameThree = new Property(10, String.class, "classNameThree", false, "CLASS_NAME_THREE");
        public final static Property ClassThreeNum = new Property(11, String.class, "classThreeNum", false, "CLASS_THREE_NUM");
        public final static Property One = new Property(12, String.class, "one", false, "ONE");
        public final static Property Two = new Property(13, String.class, "two", false, "TWO");
        public final static Property Three = new Property(14, String.class, "three", false, "THREE");
        public final static Property Four = new Property(15, String.class, "four", false, "FOUR");
        public final static Property Five = new Property(16, String.class, "five", false, "FIVE");
        public final static Property Six = new Property(17, String.class, "six", false, "SIX");
        public final static Property Sevent = new Property(18, String.class, "sevent", false, "SEVENT");
    }


    public CommonUserDao(DaoConfig config) {
        super(config);
    }
    
    public CommonUserDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"COMMON_USER\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
                "\"NAME\" TEXT," + // 1: name
                "\"SEX\" TEXT," + // 2: sex
                "\"PHONE\" TEXT," + // 3: phone
                "\"PWD\" TEXT," + // 4: pwd
                "\"PWD_STATUS\" TEXT," + // 5: pwdStatus
                "\"CLASS_NAME_ONE\" TEXT," + // 6: classNameOne
                "\"CLASS_ONE_NUM\" TEXT," + // 7: classOneNum
                "\"CLASS_NAME_TWO\" TEXT," + // 8: classNameTwo
                "\"CLASS_TWO_NUM\" TEXT," + // 9: classTwoNum
                "\"CLASS_NAME_THREE\" TEXT," + // 10: classNameThree
                "\"CLASS_THREE_NUM\" TEXT," + // 11: classThreeNum
                "\"ONE\" TEXT," + // 12: one
                "\"TWO\" TEXT," + // 13: two
                "\"THREE\" TEXT," + // 14: three
                "\"FOUR\" TEXT," + // 15: four
                "\"FIVE\" TEXT," + // 16: five
                "\"SIX\" TEXT," + // 17: six
                "\"SEVENT\" TEXT);"); // 18: sevent
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"COMMON_USER\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, CommonUser entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String name = entity.getName();
        if (name != null) {
            stmt.bindString(2, name);
        }
 
        String sex = entity.getSex();
        if (sex != null) {
            stmt.bindString(3, sex);
        }
 
        String phone = entity.getPhone();
        if (phone != null) {
            stmt.bindString(4, phone);
        }
 
        String pwd = entity.getPwd();
        if (pwd != null) {
            stmt.bindString(5, pwd);
        }
 
        String pwdStatus = entity.getPwdStatus();
        if (pwdStatus != null) {
            stmt.bindString(6, pwdStatus);
        }
 
        String classNameOne = entity.getClassNameOne();
        if (classNameOne != null) {
            stmt.bindString(7, classNameOne);
        }
 
        String classOneNum = entity.getClassOneNum();
        if (classOneNum != null) {
            stmt.bindString(8, classOneNum);
        }
 
        String classNameTwo = entity.getClassNameTwo();
        if (classNameTwo != null) {
            stmt.bindString(9, classNameTwo);
        }
 
        String classTwoNum = entity.getClassTwoNum();
        if (classTwoNum != null) {
            stmt.bindString(10, classTwoNum);
        }
 
        String classNameThree = entity.getClassNameThree();
        if (classNameThree != null) {
            stmt.bindString(11, classNameThree);
        }
 
        String classThreeNum = entity.getClassThreeNum();
        if (classThreeNum != null) {
            stmt.bindString(12, classThreeNum);
        }
 
        String one = entity.getOne();
        if (one != null) {
            stmt.bindString(13, one);
        }
 
        String two = entity.getTwo();
        if (two != null) {
            stmt.bindString(14, two);
        }
 
        String three = entity.getThree();
        if (three != null) {
            stmt.bindString(15, three);
        }
 
        String four = entity.getFour();
        if (four != null) {
            stmt.bindString(16, four);
        }
 
        String five = entity.getFive();
        if (five != null) {
            stmt.bindString(17, five);
        }
 
        String six = entity.getSix();
        if (six != null) {
            stmt.bindString(18, six);
        }
 
        String sevent = entity.getSevent();
        if (sevent != null) {
            stmt.bindString(19, sevent);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, CommonUser entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String name = entity.getName();
        if (name != null) {
            stmt.bindString(2, name);
        }
 
        String sex = entity.getSex();
        if (sex != null) {
            stmt.bindString(3, sex);
        }
 
        String phone = entity.getPhone();
        if (phone != null) {
            stmt.bindString(4, phone);
        }
 
        String pwd = entity.getPwd();
        if (pwd != null) {
            stmt.bindString(5, pwd);
        }
 
        String pwdStatus = entity.getPwdStatus();
        if (pwdStatus != null) {
            stmt.bindString(6, pwdStatus);
        }
 
        String classNameOne = entity.getClassNameOne();
        if (classNameOne != null) {
            stmt.bindString(7, classNameOne);
        }
 
        String classOneNum = entity.getClassOneNum();
        if (classOneNum != null) {
            stmt.bindString(8, classOneNum);
        }
 
        String classNameTwo = entity.getClassNameTwo();
        if (classNameTwo != null) {
            stmt.bindString(9, classNameTwo);
        }
 
        String classTwoNum = entity.getClassTwoNum();
        if (classTwoNum != null) {
            stmt.bindString(10, classTwoNum);
        }
 
        String classNameThree = entity.getClassNameThree();
        if (classNameThree != null) {
            stmt.bindString(11, classNameThree);
        }
 
        String classThreeNum = entity.getClassThreeNum();
        if (classThreeNum != null) {
            stmt.bindString(12, classThreeNum);
        }
 
        String one = entity.getOne();
        if (one != null) {
            stmt.bindString(13, one);
        }
 
        String two = entity.getTwo();
        if (two != null) {
            stmt.bindString(14, two);
        }
 
        String three = entity.getThree();
        if (three != null) {
            stmt.bindString(15, three);
        }
 
        String four = entity.getFour();
        if (four != null) {
            stmt.bindString(16, four);
        }
 
        String five = entity.getFive();
        if (five != null) {
            stmt.bindString(17, five);
        }
 
        String six = entity.getSix();
        if (six != null) {
            stmt.bindString(18, six);
        }
 
        String sevent = entity.getSevent();
        if (sevent != null) {
            stmt.bindString(19, sevent);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    @Override
    public CommonUser readEntity(Cursor cursor, int offset) {
        CommonUser entity = new CommonUser( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // name
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // sex
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // phone
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // pwd
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // pwdStatus
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // classNameOne
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // classOneNum
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // classNameTwo
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // classTwoNum
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // classNameThree
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // classThreeNum
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // one
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // two
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // three
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // four
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // five
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // six
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18) // sevent
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, CommonUser entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setSex(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setPhone(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setPwd(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setPwdStatus(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setClassNameOne(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setClassOneNum(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setClassNameTwo(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setClassTwoNum(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setClassNameThree(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setClassThreeNum(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setOne(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setTwo(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setThree(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setFour(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setFive(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setSix(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setSevent(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(CommonUser entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(CommonUser entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(CommonUser entity) {
        return entity.getId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
